<?php echo $this->Html->script(array('actions'),$options = array('allowCache'=>false,'safe'=>false,'inline'=>false));?>
<?php echo $this->Html->css(array('carts.index','form','actions'),null,array('inline'=>false));?>

<div class="content">
	<div class="left-column">
		
		<div class="box corners">
			<h2><?php echo __('Categories',true)?></h2>
			<?php echo $this->Categories->categories(); ?>
			<div class="clr"></div>	
		</div>
		<div class="clr"></div>	
	</div>
	
	<div class="right-column">
		<div class="items index box corners">
		
			<h2><?php echo __('Carts',true)?></h2>
			
			<?php if(isset($items) && is_array($items) && !empty($items)){?>
						<table class="display" cellpadding="10" cellspacing="10">			
						<tr>			
						<?php
						// liczba rekordow
						$catsCnt = count($items);
						$columns = 7;
						
						foreach ($items as $k => $item):
						?>
						
						<?php     	
							if(($k+1) % $columns == 0) { 
								echo "<td width=\"".(100/$columns)."%\" valign=\"bottom\" align=\"center\" class=\"last\">";
						?>
							<div class="image-icons-list">			
							<?php echo $this->Html->link($fileUpload->image($item['Upload']['name'],array('autoResize'=>true,'width'=>100,'imagePathOnly'=>false,'onContextMenu'=>"alert('all pictures are copyrighted and not for to be used without permission'); return false;"))
								, array('action' => 'view', $item['Cart']['id'],Inflector::slug($item['Cart']['name'],'-')),array('escape'=>false)); ?>&nbsp;
								<div class="clr"></div>	
							</div>
							<div class="clr"></div>	
						<?php echo "</td></tr>"; 
						      if ($k!=($catsCnt-1)) echo "<tr>"; 
						        } else { 
						       echo "<td width=\"".(100/$columns)."%\" valign=\"bottom\" align=\"center\">";			    
						?>
							<div class="image-icons-list">	
							<?php echo $this->Html->link($fileUpload->image($item['Upload']['name'],array('autoResize'=>true,'width'=>100,'imagePathOnly'=>false,'onContextMenu'=>"alert('all pictures are copyrighted and not for to be used without permission'); return false;"))
								, array('action' => 'view', $item['Cart']['id'],Inflector::slug($item['Cart']['name'],'-')),array('escape'=>false)); ?>&nbsp;
							</div>

						<?php echo "</td>"; 
						    	}
						 ?> 
						<?php endforeach; ?>
						<?php 	// uzupe�nienie ostatniego rekordu
							$numSpaces = $columns - ($catsCnt % $columns); 
						    if ($numSpaces!=0 && $numSpaces != $columns ) { 
						        for ($j=0;$j<$numSpaces;$j++) { 
						        	$last = ($j == $numSpaces -1) ? "class=\"last\"" :"";
						            echo "<td  width=\"".(100/$columns)."%\" {$last}>&nbsp;</td>"; 
						        } 
						        echo "</tr>"; 
						    }
						?>					
								
						</table>
			<?php }?>



							<p>
				<?php
				echo $this->Paginator->counter(array(
				'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
				));
				?>	</p>
			
				<div class="paging">
					<?php echo $this->Paginator->prev('<< ' . __('previous', true), array(), null, array('class'=>'disabled'));?>
					<?php echo $this->Paginator->numbers(array('separator'=>false));?>
					<?php echo $this->Paginator->next(__('next', true) . ' >>', array(), null, array('class' => 'disabled'));?>
				</div>
		</div>
		<?php if($session->check('Auth.User.id') && $this->Session->read('Auth.User.group') == 'admin' || $session->check('Auth.User.id') && $this->Session->read('Auth.User.group') == 'manag'){?>
		<div class="actions main_actions">
			<h3><?php __('Actions'); ?></h3>
			<ul>
				<li><?php echo $this->Html->link(__('Add Cart', true), array('action' => 'add')); ?></li>
				<li><?php echo $this->Html->link(__('Carts', true), array('action' => 'index'));?></li>
				<li><?php echo $this->Html->link(__('Add Category', true), array('action' => 'category_add')); ?></li>
				<li><?php echo $this->Html->link(__('Categories', true), array('action' => 'category_index')); ?> </li>
			</ul>
		</div>
		<?php }?>
	</div>
</div>
<div class="clr"></div>